package com.demo.bigdata

import org.apache.spark.{SparkConf, SparkContext}

object SaveDemo {
  def main(args: Array[String]): Unit = {
    val conf = (new SparkConf).setMaster("local").setAppName("Demo");
    val sc = new SparkContext(conf)
    val lines = sc.textFile("data.txt")
    val result = lines.flatMap{ x => x.split(" ")}
    result.saveAsTextFile("./output")
  }
}
